import { Injectable } from '@angular/core';

import { CategoryName } from './pipes/categoryNamePipe';

@Injectable()
export class AppSettings {

  constructor(private categoryName: CategoryName) { }


  public static API_ENDPOINT = 'http://127.0.0.1:6666/api/';


  roleNavList: any = [];

  roleNavInit(user) {
    let info = user.activeVersionInfo;

    this.roleNavList.length = 0;

    // 行业
    if (info.categoryCount != 0) {

      this.roleNavList.push({ "path": "/dashborad", "name": "行业分析", "icon": "fa-signal" });

    }


    // 品牌监控
    if (info.brandCount != 0) {

      this.roleNavList.push({ "path": "/monitorBrand", "name": "品牌监控", "icon": "fa-flag" });
    }

    // 店铺监控
    if (info.shopCount != 0) {

      this.roleNavList.push({ "path": "/monitorShop", "name": "店铺监控", "icon": "fa-home" });

    }

    // 商品监控
    if (info.productCount != 0) {

      this.roleNavList.push({ "path": "/monitorProduct", "name": "商品监控", "icon": "fa-shopping-bag" });

    }


    // 属性分析
    // this.roleNavList.push({ "path": "/attr", "name": "属性分析", "icon": "fa-code" });


    // 网红直播
    if(info.netRed){
      this.roleNavList.push({ "path": "/live", "name": "淘宝直播", "icon": "fa-fire" });
    }





    //通用

    this.roleNavList.push({ "path": "/custom", "name": "数据定制", "icon": "fa-comments" });
    this.roleNavList.push({ "path": "/question", "name": "常见咨询", "icon": "fa-question-circle-o" });



    // this.roleNavList.push({ "path": "/word", "name": "最鲜商机", "icon": "fa-tags" });
    // this.roleNavList.push({ "path": "/product", "name": "商品数据", "icon": "fa-shopping-bag" });
    // this.roleNavList.push({ "path": "/shop", "name": "店铺数据", "icon": "fa-home" });


    // console.log(this.roleNavList);

  }
    // 用户权限
  getRoleNavList() {
    return this.roleNavList;
  }



  // 日销，月销
  public sellTime = {
    type: 'day',
    value: '日销'
  };

  setSellTime(timeType) {

    Object.assign(this.sellTime, timeType);
  }

  getSellTimeType() {
    return this.sellTime.type;
  }



  // 用户类目
  public cat = {
    catName: "",//catName == "/"?"全类目":catName,
    wholeName: "",//catName == ""?"":catName,
    categoryId: ""//this.user.activeVersionInfo.category
  };

  // 设置用户类目
  setAppCat(cat) {
    Object.assign(this.cat, cat);

  }
  // 获取用户类目
  getAppCat() {

    return this.cat;
  }

 





}
